#!/bin/python3
import requests as rq
import json

def test():
    url_song = "http://music.moresound.tk/api.php?get_song=it4g"
    url = "http://music.moresound.tk/api.php?search=it4g"
    headers = {"User-Agent":"Mozilla/5.0 Windows NT 10.0; Win64; x64) AppleWebKit/537.36 KHTML,(( like Gecko ) Chrome/81.0.4044.113 Safari/537.36)", "Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}
    cookies = "XLA_CI=eae10004267d327aa73864aca4f4942c; IP=Tk9Y2ilamDyMBYcIMLThoXTtnrwjL5SikzUPG6WWY%252FU%253D; QQMUSIC_SIP=%5B%22http%3A//111.27.123.12/amobile.music.tc.qq.com/%22%2C%22http%3A//111.27.123.13/amobile.music.tc.qq.com/%22%2C%22http%3A//111.27.123.14/amobile.music.tc.qq.com/%22%5D; QQ="
    cookie_dict = {i.split("=")[0]:i.split("=")[-1] for i in cookies.split("; ")} 

    #data = {"w":"mojito", "p":"1", "n":"20"}
    #reqdata = json.dumps(data).replace("+", "%2B").encode("utf-8")
    reqdata = "w=mojito&p=1&n=20"
    songdata = "mid=111947160"

    resp = rq.post(url=url_song, headers=headers, data=songdata, cookies=cookie_dict)
    print(resp.status_code, resp.text)

    #print(cookie_dict)

if __name__ == "__main__":
    test()
